from rest_framework import serializers
from .models import Area
class AreaSerializer(serializers.ModelSerializer):

	class Meta:
		model = Area
		fields = ['id','name','subs']

class AreaSubSerializer(serializers.ModelSerializer):
	# areas = [Area,Area] 在模型中，也是需要进行序列化转换
	# AreaSerializer(areas,many=True)
	# area_set = AreaSerializer(many=True)

	subs = AreaSerializer(many=True)

	class Meta:
		model = Area
		fields = ['id','name','subs']